UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XgKl8oDr3GJKR4KJFXl1xSPZFSTZnvgosb03+jITu9w=' 
WHERE 
  key_id = '47959758293c0d91934c4a39a47642c21a08073fbf2a9de7edd9cfe3eaef3b56' 
  AND (
    token = 'XgKl8oDr3GJKR4KJFXl1xSPZFSTZnvgosb03+jITu9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041