UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HVkRbEEpv2It9zDAgDRUKSFlN7InTcQrXBe/Qm+rHWk=' 
WHERE 
  key_id = '33f2ac0573d74cb256b1fde086e6eb31fe9b1278e28c39ca197aad9607eb7246' 
  AND (
    token = 'HVkRbEEpv2It9zDAgDRUKSFlN7InTcQrXBe/Qm+rHWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064