UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bkgGbzEmuRwiqH1d49G9X/MKxicQBW0JPLN32Ip3bic=' 
WHERE 
  key_id = 'b12b482c62cc9a5c580f80adca7f6fb609a1759f236a26b246510bcce9788c73' 
  AND (
    token = 'bkgGbzEmuRwiqH1d49G9X/MKxicQBW0JPLN32Ip3bic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033