UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ZmLsdowVdGHQxw2ax4eeMc/xj9YvdOSNshdZqNVXls='
WHERE
key_id = 'aee5f652c54ddf9882efb80f4093e30558db4a60b599c1a5a364c10de98b5f4d'
AND (
token = '8ZmLsdowVdGHQxw2ax4eeMc/xj9YvdOSNshdZqNVXls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)