UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KiErwgKaJpKXe0I8aiIOTGfr20uloz/5rcEKN0IoG3g='
WHERE
key_id = '15b355bd07a2deffe4acd0931f7032a98df78b589b44b67a4a95ccc8fa89cae7'
AND (
token = 'KiErwgKaJpKXe0I8aiIOTGfr20uloz/5rcEKN0IoG3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)