UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '506EvYP64ki5bR4mWyh9wJ43P7A9KFhs9nigorc40W8='
WHERE
key_id = '30f78b95436878433c1072e95a43a0867a03c300e5fb19b26fe296898f47f202'
AND (
token = '506EvYP64ki5bR4mWyh9wJ43P7A9KFhs9nigorc40W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)