UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iqNJ3AFQEztjY15zMfQ2LVPbLAXHLh2dlXMminTIBDo=' 
WHERE 
  key_id = 'e07db39e0f25ded4f541cf9d98eedc0893f489b8b6148fdb22e2e2abb2460055' 
  AND (
    token = 'iqNJ3AFQEztjY15zMfQ2LVPbLAXHLh2dlXMminTIBDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027