UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JeG9ZI3uACLsMrbe97zqwKVuQwNoxE8lcvGexTl4TY8='
WHERE
key_id = '31d2730916bfeadf0ac9f697821ce73fbdae0e70da3406b94816ae020a04d2a3'
AND (
token = 'JeG9ZI3uACLsMrbe97zqwKVuQwNoxE8lcvGexTl4TY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)