UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WPVyihzk3rHfUFlllJKzekKIFmIHzycHZhPIaMpr9RU=' 
WHERE 
  key_id = '39473ef841d3724f5a513f732aca713bed7bf3ca5fadb81beae79d6cd08c5834' 
  AND (
    token = 'WPVyihzk3rHfUFlllJKzekKIFmIHzycHZhPIaMpr9RU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042