UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JK+4nkhSKOf5qhQSizEh7Ee83vEhgIfka0U815l43qY=' 
WHERE 
  key_id = 'd405724610952536b7534084ed76e4082d7c9ad3c58a25cbc3c8cf423d1601ee' 
  AND (
    token = 'JK+4nkhSKOf5qhQSizEh7Ee83vEhgIfka0U815l43qY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026