UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9c7apNQMqsaBpIJX48RGPmXBFBwQVYXKJXRYZQKdsI=' 
WHERE 
  key_id = '48ff4e493601c24c73b6a22795249440573f516d26cf8e3b24c5cc2d26e1c650' 
  AND (
    token = 'd9c7apNQMqsaBpIJX48RGPmXBFBwQVYXKJXRYZQKdsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038