UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xgyV2svYMT3WnLyMr2hKnZXUuIJWeSFkjYInrTqchww=' 
WHERE 
  key_id = '90ef258ca73797c122d39f63d0f18026a31f440e53f19ab097b9fb381aed5ed0' 
  AND (
    token = 'xgyV2svYMT3WnLyMr2hKnZXUuIJWeSFkjYInrTqchww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030