UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6vRJLuLyM0UuLJWYpWJ4cAW+3/0p7g75y85xMTE94ug='
WHERE
key_id = 'b4d99a5fe95828f2e5dae61c7436ad35fa65df69d858ea5fa0918548677dd8b7'
AND (
token = '6vRJLuLyM0UuLJWYpWJ4cAW+3/0p7g75y85xMTE94ug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)