UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'li+0aO7k/Tli3UA3+AZcnlfvfoPli2GRLmad4KE6tjA=' 
WHERE 
  key_id = 'f9095cc4bb0e0bc6febdc669dc38428d5fbb3069d90bb40a138d75db10b6a513' 
  AND (
    token = 'li+0aO7k/Tli3UA3+AZcnlfvfoPli2GRLmad4KE6tjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043