UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugJRSNW5+xXyLKrMSGEl86WwESSOb/IuffuwL7QWbpc=' 
WHERE 
  key_id = '12f7ce45f2513d98145f2dd509e0e425bb663e63c15ef6b0e4436ec907834383' 
  AND (
    token = 'ugJRSNW5+xXyLKrMSGEl86WwESSOb/IuffuwL7QWbpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035