UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '58OsvnKbj81dxTsEgTvvrvvTae3wO8rXDYUXADy7/Zc='
WHERE
key_id = 'cdae3a3d68f853a0d7026a0cc845b10f109700b73f5e42d36ad74a8d13a9db99'
AND (
token = '58OsvnKbj81dxTsEgTvvrvvTae3wO8rXDYUXADy7/Zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)