UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5DcFkbAGTpYiY21ehDkBz8HT7Di7pqh0LVrl1V+LZU0='
WHERE
key_id = '8e2f99dd340c31ad57ceb456fae8327e5d5e1455d61f7cb4b4156af1b09792d9'
AND (
token = '5DcFkbAGTpYiY21ehDkBz8HT7Di7pqh0LVrl1V+LZU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)