UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zUuVl1GYsRCVk3e+WKAA5vcEzhQGRrbgRMRLLcaxVZg=' 
WHERE 
  key_id = '1dc62b67171fb534bb20f49ebf2e919198f2c80fb0b13f84ed4da75f659f523b' 
  AND (
    token = 'zUuVl1GYsRCVk3e+WKAA5vcEzhQGRrbgRMRLLcaxVZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025