UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yx01Kz++iej9No3+Pw2lT0yzQhAL5+V6CsogTFUIAKk='
WHERE
key_id = '5bd2b535c3ef58cf49f7d14d536835702f36a5bb04791d8995658f865dad8a7a'
AND (
token = 'yx01Kz++iej9No3+Pw2lT0yzQhAL5+V6CsogTFUIAKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)