UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kp4H+HAXYgBnMLV479wmHdKeRn3oPEf8c/ZX25n91S0='
WHERE
key_id = 'afe9c3e6eed4957132b4aa80175a1ed24362a4b4b89f49d321cde2c3c3e094a1'
AND (
token = 'Kp4H+HAXYgBnMLV479wmHdKeRn3oPEf8c/ZX25n91S0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)