UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mnjje2tbWGstlsyYe6ArScL6HwsDmkLd7Ldp1UEzDsI=' 
WHERE 
  key_id = '1c851d2a916ea13fc77562e33d82cd8ac9f49d5000083d160a33a5b3d726640f' 
  AND (
    token = 'Mnjje2tbWGstlsyYe6ArScL6HwsDmkLd7Ldp1UEzDsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047