UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cFon1sgFIJO8XwKoWcCkJiTcBSmz8M0OIw8RKIvD/hQ='
WHERE
key_id = '249d5f260c2a797f1f298225474b9b9dbd540e7f16a32761662f8e5b1fe0b578'
AND (
token = 'cFon1sgFIJO8XwKoWcCkJiTcBSmz8M0OIw8RKIvD/hQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)