UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4CWKd5UZFipS9m31VSiVqqN9HsVWDYwumBBDuqY3w8Y=' 
WHERE 
  key_id = 'dbe2382bbfd84cbf1aee562d392ef6c1fe3c33994c57354d35d1b3b438c83188' 
  AND (
    token = '4CWKd5UZFipS9m31VSiVqqN9HsVWDYwumBBDuqY3w8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037