UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HPV/BEYlwU6/re1VEvdvq3M4tktqtbqQcG/bGsO+nUo=' 
WHERE 
  key_id = '14d5810d9797d75f97b3b4cd0e28b35f78312095b3ccd816cb243f7facc85d03' 
  AND (
    token = 'HPV/BEYlwU6/re1VEvdvq3M4tktqtbqQcG/bGsO+nUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039