UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HDdwXxiL4wMFu+Aty47eiZKvAnMcLwXVBrL9kURfLLw='
WHERE
key_id = '9fbe48b8f75a8ccbca19b92fa06bc71927c3b8dfca63f31520a35311be30d815'
AND (
token = 'HDdwXxiL4wMFu+Aty47eiZKvAnMcLwXVBrL9kURfLLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)