UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZHp75SYzgnYEwsmGVfa/C27GRrmAb+k/a3sLpGTApU=' 
WHERE 
  key_id = '25207f091d4292d768d00bf18cd2dc1f4349520b529d86f430f7856d8f020a8e' 
  AND (
    token = 'CZHp75SYzgnYEwsmGVfa/C27GRrmAb+k/a3sLpGTApU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050