UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uqd8g2anRYicgyBYeCL0ZcL8SqXsaM0OY2ZJtRc39xs=' 
WHERE 
  key_id = 'b8d2bf68198c6d6e2ed811cf78064443dfb22bda642146a6813d0966a304ebe2' 
  AND (
    token = 'uqd8g2anRYicgyBYeCL0ZcL8SqXsaM0OY2ZJtRc39xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030