UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kkgKC7Uum6V0qPbo1PdC1Fk1LN1luXMo77yjC2FOOTY='
WHERE
key_id = '6f06b2597a6066029d1b44c95b1a03050661a95e6597318b96a524600a5442fc'
AND (
token = 'kkgKC7Uum6V0qPbo1PdC1Fk1LN1luXMo77yjC2FOOTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)