UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UwNyx01d5vUtFDga+34lgAepxxH4AdUK6t1q41ZFhnI='
WHERE
key_id = '22f062470d5779bfb734e416686be0f598fc89a1f9988b1c810936787dafa7e4'
AND (
token = 'UwNyx01d5vUtFDga+34lgAepxxH4AdUK6t1q41ZFhnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)