UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'incPb+xUl62uMU7wGcmvSpyoOnRhapOSGMaryoKdVX8=' 
WHERE 
  key_id = '3677b031098776a382f9a67da4bbcdccdcdaeef70445c761488fa5f89fef382d' 
  AND (
    token = 'incPb+xUl62uMU7wGcmvSpyoOnRhapOSGMaryoKdVX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028