UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8dpnV3OmeSl5tfbG2edL2y2tjf+W/8ISs5Lt1BdUKh8='
WHERE
key_id = 'f4d9ab1023fc0114c5860935c8d939934e4a3ddebd5ea0521a4b54b8ee7d006d'
AND (
token = '8dpnV3OmeSl5tfbG2edL2y2tjf+W/8ISs5Lt1BdUKh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)