UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cuBKfsfThwDcx4zkn1ukZJLaOfbLO7zB9vvdSTZkJpI='
WHERE
key_id = '5986c576e8012628dcc713aaedbd5cfcdd5a67728eb0215d784cc598e2c520aa'
AND (
token = 'cuBKfsfThwDcx4zkn1ukZJLaOfbLO7zB9vvdSTZkJpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)