UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8gw3wXXtjPG5dIYDv3zExVtQo/usWRi7LpM1S4O12w='
WHERE
key_id = '54c9c01567aacbbf29bd3a276e501350a1dd1bad3f3dc32765dcc27918416bb0'
AND (
token = 'S8gw3wXXtjPG5dIYDv3zExVtQo/usWRi7LpM1S4O12w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)