UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0T2oT58cZX0KPEf3o0Pn8Tg9Xn7cuiX0IpzHKfuyy18='
WHERE
key_id = '864183a5842652f059804bce93e4559ab9bee312416a5ec437b0e77a9312b80a'
AND (
token = '0T2oT58cZX0KPEf3o0Pn8Tg9Xn7cuiX0IpzHKfuyy18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)