UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2QEBIswr3dh/x8v50BZ8fx+zECVIxaEUbhZF2dNGJb4='
WHERE
key_id = 'e2f94d6322106c2485077bf42112158706a548ca6bdb83ebf2b3c95091a430ef'
AND (
token = '2QEBIswr3dh/x8v50BZ8fx+zECVIxaEUbhZF2dNGJb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)