UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e4LuAUrTpEi7mDlZxXLdiFIPPtrsmmJHJukOuKZcli8='
WHERE
key_id = '8f446ee1361133fde347b4525c746dcd03ee1c6f3a34c431d9c4a1eb2171f63b'
AND (
token = 'e4LuAUrTpEi7mDlZxXLdiFIPPtrsmmJHJukOuKZcli8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)