UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZJuhBwCgwOWspxubZljjtzIyYxT4bmCHfhA0TXDkxdk='
WHERE
key_id = '59388ba8e6684ddfffc262c2e9bbbde04e9aeb0200857a9a89502e5e29320b6d'
AND (
token = 'ZJuhBwCgwOWspxubZljjtzIyYxT4bmCHfhA0TXDkxdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)