UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k8UmawdqT1Rxtl3c2Ct/JNx261ZsMdph+/GWAwHs+Y8='
WHERE
key_id = '3920f1fb235c2e627f326bd96ea7a2e118029c4b8a14169271f91a14b866a478'
AND (
token = 'k8UmawdqT1Rxtl3c2Ct/JNx261ZsMdph+/GWAwHs+Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)