UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vgRjiEmctvonyXN7ZLdqtP9TIGhsuoD9GY5XQGU3nqk='
WHERE
key_id = '9167855f8e45f613c3d1600ef0a746f4f83b889d040eeac487e0797698ca04fa'
AND (
token = 'vgRjiEmctvonyXN7ZLdqtP9TIGhsuoD9GY5XQGU3nqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)