UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8YK0yIpRjyn7eiVbkdjgOW5tM3ZtvKyA+6I9CpXypbw=' 
WHERE 
  key_id = '3444b2a5a2d4550ff57158f329e11f985570c75d3a2de7cd0f1af99a97875850' 
  AND (
    token = '8YK0yIpRjyn7eiVbkdjgOW5tM3ZtvKyA+6I9CpXypbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032