UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n9V756G8cwtgDUi0drct2B2WPRTPdyW+fLVgsYuLtT8='
WHERE
key_id = 'c8a3dbc5245316226eb1e6befeb3ef17718e00cc0a54ddc62179a2ddbde594c4'
AND (
token = 'n9V756G8cwtgDUi0drct2B2WPRTPdyW+fLVgsYuLtT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)