UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dovs6M9XVWy4gjQ95UtL0fwEiFZD6VTDe4ko/6RUK/I=' 
WHERE 
  key_id = 'ef863cdb91de9e90ffe07873caa323360dc9c145944fd4e0264b5e5809e66460' 
  AND (
    token = 'dovs6M9XVWy4gjQ95UtL0fwEiFZD6VTDe4ko/6RUK/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030