UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gufWTW5eGvrBF2VPDLUmju5srMC6IjaC43jvFRMixYE=' 
WHERE 
  key_id = '35d55f4e6424086aa0c7a01ec0f718a4cc9b3dad3d94d5387021313cc62457f6' 
  AND (
    token = 'gufWTW5eGvrBF2VPDLUmju5srMC6IjaC43jvFRMixYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064