UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'alpUuAVDQcr7m0oiyyNAmZA8z1vUhNJ9sIZwN50LhT0='
WHERE
key_id = 'ba61a9cb2066959324f1792ed939c01566ba305e913e60ea7f44539a33a2d249'
AND (
token = 'alpUuAVDQcr7m0oiyyNAmZA8z1vUhNJ9sIZwN50LhT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)