UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sMJkwF/RVHOBtc+BU15fs4yj2ave2qzeurQoEY9nsoE='
WHERE
key_id = 'd997dc3668b0689d2785687912afe22ab1e9c9a5ad60d085e21608d98f0065a0'
AND (
token = 'sMJkwF/RVHOBtc+BU15fs4yj2ave2qzeurQoEY9nsoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)