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

Query time 0.00028