UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avG8yNylRrvO4XOEhJw8qLwTXbUKrkK6YGR4iPAWXQ4=' 
WHERE 
  key_id = '7c672a0b02e4e002f199451184ae6065789facc4b6aed87c29b63e20869b654c' 
  AND (
    token = 'avG8yNylRrvO4XOEhJw8qLwTXbUKrkK6YGR4iPAWXQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042