UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ju5NhRLdL5tGkXEvy/LkfQUdDGjOTRLXRn2TVtwIuPQ=' 
WHERE 
  key_id = '8dd0990ddd82349df9c3802a7501681f9792a64271b07f63735e763837e8fca0' 
  AND (
    token = 'Ju5NhRLdL5tGkXEvy/LkfQUdDGjOTRLXRn2TVtwIuPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016