UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'da5lk3mJ+GO8L7CzRiWZ8KlYhGojzEy5lcJkkvynLVQ=' 
WHERE 
  key_id = 'bd5b46cfae003f288b66af2a21783c4421a229305ff3d1b57cf4d00ea2138082' 
  AND (
    token = 'da5lk3mJ+GO8L7CzRiWZ8KlYhGojzEy5lcJkkvynLVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027