UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g81BxABIehnBy1KbU/VTLam59mEuc7aijCEYMC5CmRQ='
WHERE
key_id = 'c8904f51aaa01593286514404f3c4f2b5ee264ef599c3b42008f1208cd09a04d'
AND (
token = 'g81BxABIehnBy1KbU/VTLam59mEuc7aijCEYMC5CmRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)