UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NcMXsnjRQ9Tb+8tsnHNfRT3QWyA0kyZYvLcg0yT6lYU='
WHERE
key_id = '00857215293f51712b57560b52a02ae1cdcbd7fe8936a1708ade139b79f49ce0'
AND (
token = 'NcMXsnjRQ9Tb+8tsnHNfRT3QWyA0kyZYvLcg0yT6lYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)