UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WSI3nME4ZvhJ9qCbBzunqL5hQCRruaMaVvOfs3JCnsI='
WHERE
key_id = 'e881795aaf0593ebf450df1f198641741df32be6a1ba18fc33e62366318ee38c'
AND (
token = 'WSI3nME4ZvhJ9qCbBzunqL5hQCRruaMaVvOfs3JCnsI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)