UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ERleYM2HJj3KXZrW03mA9sR1wDKlheyAeR1xFWoIr4='
WHERE
key_id = '07a6c3bebeb7a03920335edcda5b83b1f6408afa27daba73a4148dca5f4f7cee'
AND (
token = '0ERleYM2HJj3KXZrW03mA9sR1wDKlheyAeR1xFWoIr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)