UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j3VqbwmIqqjSbliC1vSSVlDvUFALuPwdE//7BYNzdCo='
WHERE
key_id = '6d20347f3cb40da90294c271a2d10b4cc0bcdf5d511b337a5961d7a1ba356544'
AND (
token = 'j3VqbwmIqqjSbliC1vSSVlDvUFALuPwdE//7BYNzdCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)