UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GReUbyoL92uWPSUMOZysOrQlrKhHIECspxMukXorS+E=' 
WHERE 
  key_id = 'c80fa600cc526766504f47f1c445f6fd8ac2a9b2f288d6b16cfe838f26c88956' 
  AND (
    token = 'GReUbyoL92uWPSUMOZysOrQlrKhHIECspxMukXorS+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040