UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KiC49ejjCjlcM46q3LVW+OL6uRL0UAX03Rscawe9LNY='
WHERE
key_id = 'af905108faba72338af7447c984c3c58c911857e81c0413d5defa3be42daef89'
AND (
token = 'KiC49ejjCjlcM46q3LVW+OL6uRL0UAX03Rscawe9LNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)