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