UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RKrf/TeNjLzWnp8FODoY4XJSKHSKwa0agWXFOM6Cpss='
WHERE
key_id = '0828cdb4c7c8dc180cb1d6b7dc54485b7eac7a2f2be2480d039e647d64c6717f'
AND (
token = 'RKrf/TeNjLzWnp8FODoY4XJSKHSKwa0agWXFOM6Cpss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)