UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sOUsNXoW+m9Gz08qHUu4rJ4QgS+FnFHOfIOLcoTY1Ks='
WHERE
key_id = 'b4930f89cc42afeac769f61714512f6c87a6012b0849ebf85cbedfa01102b48c'
AND (
token = 'sOUsNXoW+m9Gz08qHUu4rJ4QgS+FnFHOfIOLcoTY1Ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)