UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MXgM52EixV29voQKkSBkkGX5Cd7/T2L5lxKtsSDaC8I='
WHERE
key_id = '1a7d27f7c498daf92d7375bb4a6521034d8d243a82175abe3d0a7e2ffd276aee'
AND (
token = 'MXgM52EixV29voQKkSBkkGX5Cd7/T2L5lxKtsSDaC8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)